<?php
date_default_timezone_set('Asia/Chongqing');
require '../vendor/autoload.php';
$app = new \Slim\Slim();
define('APP_ROOT', dirname(__DIR__));
$app->config(array(
    'templates.path' => APP_ROOT . '/templates',
    'cookies.encrypt' => true,
    'cookies.lifetime' => '12 months',
    'cookies.httponly' => true,
    'cookies.secret_key' => 'a98[32]',
    'cookies.cipher' => MCRYPT_RIJNDAEL_256,
    'cookies.cipher_mode' => MCRYPT_MODE_CBC,
    'view' => new \Slim\Views\Twig()
));
$c = new \Pimple\Container();

$redis = new \Predis\Client(array(
    'scheme'=>'tcp',
    'host'=>'127.0.0.1',
    'port'=>6379,
    'database'=>15,
    'read_write_timeout'=>0
));

include(APP_ROOT . '/di/log.php');
include(APP_ROOT . '/di/middleware.php');
include(APP_ROOT . '/di/mode.php');
include(APP_ROOT . '/di/db.php');
include(APP_ROOT . '/di/view.php');
include(APP_ROOT . '/di/hook.php');

$app->get('/', function () use ($app) {
    $app->render('index.html');
})->name('home');


include(APP_ROOT . '/routes/account.php');
include(APP_ROOT . '/routes/user.php');

include(APP_ROOT . '/routes/task/task.php');

include(APP_ROOT . '/routes/review.php');

include(APP_ROOT . '/routes/test.php');

include(APP_ROOT . '/routes/blue.php');

include(APP_ROOT . '/routes/jokes.php');
include(APP_ROOT . '/routes/articles.php');
$app->run();
